home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1199 / 1038 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  7.8 KB

  1. From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
  2. Date: Fri, 18 Feb 94 10:41:00 +0100
  3. Message-Id: <9402180941.AA05180@issan.informatik.uni-dortmund.de>
  4. To: mint@atari.archive.umich.edu
  5. Subject: MiNT 1.10: misc bug fixes
  6.  
  7. Note: these patches assume that you already applied my previous
  8. patches about optimizations. There will be some conflicts otherwise.
  9.  
  10. biosfs.c:
  11. - bios_remove, bios_fscntl: `dir' is no longer unused
  12. - bios_symlink: the \dev\fd directory supports no symlinks (the link
  13. would go into the root directory instead)
  14. - bios_ioctl (TCURS[GS]RATE): the mode TCURSSRATE of Cursconf doesn't
  15. return anything useful.
  16. - bios_select: inverted sense of collision check
  17. - bios_close: wake processes waiting for lock
  18.  
  19. fasttext.c:
  20. - screen_select: return 2 on collision
  21.  
  22. main.c:
  23. - do_file: don't close the file twice
  24.  
  25. pipefs.c:
  26. - pipe_open: O_CREAT only means "create *if not existing*", use
  27. O_TRUNC to check for Fcreate.
  28.  
  29. proc.c:
  30. - fork_proc: only copy the first 128 bytes of the command line, it is
  31. not required to be zero-terminated.
  32.  
  33. procfs.c:
  34. - proc_getname: look at size
  35.  
  36. signal.c:
  37. - handle_sig: only count signals that call a user routine, in the
  38. other cases the system call is not really interrupted.
  39.  
  40. tosfs.c:
  41. - tos_lookup, tos_getxattr: preserve the FA_DELETE flag
  42. - tos_ioctl: implement FIONREAD correctly
  43.  
  44. tty.c:
  45. - tty_ioctl (TIOCSETP): set the tty state accordingly
  46.  
  47. unifs.c:
  48. - do_ulookup, uni_rename: only use the first NAME_MAX characters of
  49. the file name
  50. - uni_remove: use case insensitive compare
  51.  
  52. -------------------- cut here --------------------
  53. diff -ur orig/biosfs.c ./biosfs.c
  54. --- orig/biosfs.c    Thu Feb 17 23:19:02 1994
  55. +++ ./biosfs.c    Thu Feb 17 20:58:18 1994
  56. @@ -489,8 +489,6 @@
  57.  {
  58.      struct bios_file *b, **lastb;
  59.  
  60. -    UNUSED(dir);
  61. -
  62.      if (curproc->euid)
  63.          return EACCDN;
  64.  
  65. @@ -736,8 +734,6 @@
  66.      struct bios_file *b;
  67.      static int devindex = 0;
  68.  
  69. -    UNUSED(dir);
  70. -
  71.      if (curproc->euid) {
  72.          DEBUG(("biosfs: Dcntl() by non-privileged process"));
  73.          return ((unsigned)cmd == DEV_INSTALL) ? 0 : EACCDN;
  74. @@ -816,6 +812,9 @@
  75.      if (curproc->euid)
  76.          return EACCDN;
  77.  
  78. +    if (IS_FD_DIR (dir))
  79. +      return EACCDN;
  80. +
  81.      r = bios_lookup(dir, name, &fc);
  82.      if (r == 0) return EACCDN;    /* file already exists */
  83.      if (r != EFILNF) return r;    /* some other error */
  84. @@ -1510,7 +1509,7 @@
  85.          if (f->fc.aux != 2)
  86.            return EINVFN;
  87.          r = Cursconf(mode - TCURSOFF, *((short *)buf));
  88. -        if (r >= 0) {
  89. +        if (r >= 0 && mode == TCURSGRATE) {
  90.              *(short *)buf = r;
  91.              r = 0;
  92.          }
  93. @@ -1581,7 +1580,7 @@
  94.          }
  95.          if (tty) {
  96.          /* avoid collisions with other processes */
  97. -            if (!tty->rsel)
  98. +            if (tty->rsel)
  99.                  return 2;    /* collision */
  100.              tty->rsel = p;
  101.          }
  102. @@ -1592,7 +1591,7 @@
  103.              return 1;
  104.          }
  105.          if (tty) {
  106. -            if (!tty->wsel)
  107. +            if (tty->wsel)
  108.                  return 2;    /* collision */
  109.              tty->wsel = p;
  110.          }
  111. @@ -1628,6 +1627,8 @@
  112.      b = (struct bios_file *)f->fc.index;
  113.      if ((f->flags & O_LOCK) && (b->lockpid == pid)) {
  114.          b->lockpid = 0;
  115. +        f->flags &= ~O_LOCK;
  116. +        wake (IO_Q, (long)b);    /* wake anyone waiting for this lock */
  117.      }
  118.      return 0;
  119.  }
  120. diff -ur orig/fasttext.c ./fasttext.c
  121. --- orig/fasttext.c    Wed Feb  9 22:39:50 1994
  122. +++ ./fasttext.c    Thu Feb 17 20:13:24 1994
  123. @@ -1373,6 +1373,8 @@
  124.          /* avoid collisions with other processes */
  125.              if (!tty->rsel)
  126.                  tty->rsel = p;
  127. +            else
  128. +              return 2; /* collision */
  129.          }
  130.          return 0;
  131.      } else if (mode == O_WRONLY) {
  132. diff -ur orig/main.c ./main.c
  133. --- orig/main.c    Fri Feb 11 19:37:16 1994
  134. +++ ./main.c    Thu Feb 17 20:20:08 1994
  135. @@ -1468,7 +1468,6 @@
  136.          line[count] = 0;
  137.          do_line(line);
  138.      }
  139. -    f_close(fd);
  140.  }
  141.  
  142.  void
  143. diff -ur orig/pipefs.c ./pipefs.c
  144. --- orig/pipefs.c    Thu Feb 17 23:19:10 1994
  145. +++ ./pipefs.c    Thu Feb 17 21:19:24 1994
  146. @@ -544,7 +544,7 @@
  147.          }
  148.          p->flags &= ~O_HEAD;
  149.      } else {
  150. -        if (f->flags & O_CREAT) {
  151. +        if (f->flags & O_TRUNC) {
  152.              DEBUG(("pipe_open: fifo already exists"));
  153.              return EACCDN;
  154.          }
  155. diff -ur orig/proc.c ./proc.c
  156. --- orig/proc.c    Fri Feb 11 22:34:08 1994
  157. +++ ./proc.c    Thu Feb 17 22:06:20 1994
  158. @@ -157,7 +157,7 @@
  159.      }
  160.  
  161.  /* jr: copy ploadinfo */
  162. -    strcpy (p->cmdlin, curproc->cmdlin);
  163. +    strncpy (p->cmdlin, curproc->cmdlin, 128);
  164.      strcpy (p->fname, curproc->fname);
  165.  
  166.  /* clear directory search info */
  167. diff -ur orig/procfs.c ./procfs.c
  168. --- orig/procfs.c    Tue Feb 15 23:23:34 1994
  169. +++ ./procfs.c    Thu Feb 17 20:32:38 1994
  170. @@ -271,17 +271,20 @@
  171.      int size;
  172.  {
  173.      PROC *p;
  174. +    char buffer[20]; /* enough if proc names no longer than 8 chars */
  175.  
  176.      UNUSED(root);
  177. -/* BUG: we ought to look at size */
  178. -    UNUSED(size);
  179.  
  180.      if (dir->index == 0)
  181. -        *pathname = 0;
  182. +        *buffer = 0;
  183.      else {
  184.          p = (PROC *)dir->index;
  185. -        ksprintf(pathname, "%s.03d", p->name, p->pid);
  186. +        ksprintf(buffer, "%s.03d", p->name, p->pid);
  187.      }
  188. +    if (strlen (buffer) < size)
  189. +      strcpy (pathname, buffer);
  190. +    else
  191. +      return ERANGE;
  192.      return 0;
  193.  }
  194.  
  195. diff -ur orig/proto.h ./proto.h
  196. --- orig/proto.h    Fri Feb 11 19:35:00 1994
  197. +++ ./proto.h    Thu Feb 17 21:21:24 1994
  198. @@ -353,8 +353,8 @@
  199.  void ARGS_ON_STACK ALERT P_((const char *s, ...));
  200.  void ARGS_ON_STACK FORCE P_((const char *s, ...));
  201.  void PAUSE P_((void));
  202. -EXITING void ARGS_ON_STACK FATAL P_((const char *s, ...));
  203. -EXITING void HALT P_((void));
  204. +EXITING void ARGS_ON_STACK FATAL P_((const char *, ...)) NORETURN;
  205. +EXITING void HALT P_((void)) NORETURN;
  206.  void DUMPLOG P_((void));
  207.  void do_func_key P_((int));
  208.  
  209. diff -ur orig/signal.c ./signal.c
  210. --- orig/signal.c    Thu Feb 17 23:19:10 1994
  211. +++ ./signal.c    Thu Feb 17 20:36:14 1994
  212. @@ -264,7 +264,6 @@
  213.  
  214.      if (curproc->sighandle[sig] == SIG_IGN)
  215.          return;
  216. -    ++curproc->nsigs;
  217.      if (curproc->sighandle[sig] == SIG_DFL) {
  218.  _default:
  219.          switch(sig) {
  220. @@ -347,6 +346,7 @@
  221.              }
  222.          }
  223.  
  224. +        ++curproc->nsigs;
  225.          call = &curproc->ctxt[SYSCALL];
  226.  /*
  227.   * what we do is build two fake stack frames; the bottom one is
  228. diff -ur orig/tosfs.c ./tosfs.c
  229. --- orig/tosfs.c    Thu Feb 17 23:19:14 1994
  230. +++ ./tosfs.c    Thu Feb 17 20:43:22 1994
  231. @@ -507,7 +507,7 @@
  232.          ti->size = foo.dta_size;
  233.          ti->date = foo.dta_date;
  234.          ti->time = foo.dta_time;
  235. -        ti->attr = foo.dta_attrib;
  236. +        ti->attr = foo.dta_attrib | (ti->attr & FA_DELETE);
  237.          if (executable_extension(foo.dta_name))
  238.              ti->attr |= FA_EXEC;
  239.          ti->valid = 1;
  240. @@ -561,7 +561,7 @@
  241.          ti->size = foo.dta_size;
  242.          ti->date = foo.dta_date;
  243.          ti->time = foo.dta_time;
  244. -        ti->attr = foo.dta_attrib;
  245. +        ti->attr = foo.dta_attrib | (ti->attr & FA_DELETE);
  246.          if (executable_extension(foo.dta_name))
  247.              ti->attr |= FA_EXEC;
  248.  around:
  249. @@ -1152,6 +1152,10 @@
  250.  
  251.      switch (mode) {
  252.      case FIONREAD:
  253. +        r = Fseek (0L, (int) f->devinfo, 1);
  254. +        *(long *) buf = Fseek (0L, (int) f->devinfo, 2) - r;
  255. +        (void) Fseek (r, (int) f->devinfo, 0);
  256. +        return 0;
  257.      case FIONWRITE:
  258.          *((long *)buf) = 1;
  259.          return 0;
  260. diff -ur orig/tty.c ./tty.c
  261. --- orig/tty.c    Tue Feb  1 04:19:52 1994
  262. +++ ./tty.c    Thu Feb 17 20:46:40 1994
  263. @@ -483,6 +483,11 @@
  264.      case TIOCSETP:
  265.          sg = (struct sgttyb *)arg;
  266.          tty->sg = *sg;
  267. +        /* set the tty state for checking control characters */
  268. +        if (sg->sg_flags & T_RAW)
  269. +          tty->state &= ~TS_COOKED;
  270. +        else
  271. +          tty->state |= TS_COOKED;
  272.      /* set baud rates */
  273.          baud = tosbaud(sg->sg_ispeed);
  274.          (*f->dev->ioctl)(f, TIOCIBAUD, &baud);
  275. diff -ur orig/unifs.c ./unifs.c
  276. --- orig/unifs.c    Thu Feb 17 23:19:16 1994
  277. +++ ./unifs.c    Thu Feb 17 21:32:06 1994
  278. @@ -175,7 +175,7 @@
  279.   * OK, check the list of aliases and special directories
  280.   */
  281.      for (u = u_root; u; u = u->next) {
  282. -        if (!stricmp(name, u->name)) {
  283. +        if (!strnicmp(name, u->name, NAME_MAX)) {
  284.              if ( (u->mode & S_IFMT) == S_IFDIR ) {
  285.                  if (u->dev >= NUM_DRIVES) {
  286.                      fs = u->fs;
  287. @@ -295,7 +295,7 @@
  288.      lastu = 0;
  289.      u = u_root;
  290.      while (u) {
  291. -        if (!strncmp(u->name, name, NAME_MAX)) {
  292. +        if (!strnicmp(u->name, name, NAME_MAX)) {
  293.              if ( (u->mode & S_IFMT) != S_IFLNK ) return EFILNF;
  294.              kfree(u->data);
  295.              if (lastu)
  296. @@ -406,7 +406,7 @@
  297.      UNUSED(olddir);
  298.  
  299.      for (u = u_root; u; u = u->next) {
  300. -        if (!stricmp(u->name, oldname))
  301. +        if (!strnicmp(u->name, oldname, NAME_MAX))
  302.              break;
  303.      }
  304.  
  305.